<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - LandPPT</title>
    <link rel="icon" type="image/svg+xml" href="/static/images/landppt-logo.png">
    <link rel="alternate icon" href="/static/images/favicon.ico">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        @import url('https://fonts.loli.net/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

        :root {
            --black: #000000;
            --white: #ffffff;
            --gray-100: #f3f4f6;
            --gray-200: #e5e7eb;
            --gray-800: #1f2937;
            --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            height: 100vh;
            width: 100vw;
            overflow: hidden;
            display: flex;
            background-color: var(--white);
        }

        /* Split Layout */
        .split-layout {
            display: flex;
            width: 100%;
            height: 100%;
        }

        /* Left Side - Branding */
        .brand-section {
            flex: 1;
            background-color: var(--black);
            color: var(--white);
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 4rem;
            position: relative;
            overflow: hidden;
        }

        .brand-pattern {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image:
                radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.15) 1px, transparent 0);
            background-size: 40px 40px;
            opacity: 0.5;
            pointer-events: none;
        }

        .brand-content {
            position: relative;
            z-index: 1;
            max-width: 600px;
        }

        .brand-logo {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 2rem;
        }

        .brand-logo img {
            width: 64px;
            height: 64px;
            /* Logo Optimization: White background container */
            background-color: var(--white);
            padding: 8px;
            border-radius: 12px;
            filter: none;
        }

        .brand-title {
            font-size: 4rem;
            font-weight: 800;
            line-height: 1.1;
            margin-bottom: 1.5rem;
            letter-spacing: -0.02em;
        }

        .brand-subtitle {
            font-size: 1.25rem;
            font-weight: 300;
            opacity: 0.8;
            line-height: 1.6;
            max-width: 480px;
        }

        /* Right Side - Form */
        .form-section {
            flex: 1;
            background-color: var(--white);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem;
            position: relative;
        }

        .form-container {
            width: 100%;
            max-width: 420px;
            padding: 2rem;
        }

        .form-header {
            margin-bottom: 3rem;
        }

        .form-header h2 {
            font-size: 2rem;
            font-weight: 700;
            color: var(--black);
            margin-bottom: 0.5rem;
            letter-spacing: -0.01em;
        }

        .form-header p {
            color: var(--gray-800);
            font-size: 0.95rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-group label {
            display: block;
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--black);
            margin-bottom: 0.5rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .input-wrapper {
            position: relative;
        }

        .form-group input {
            width: 100%;
            padding: 1rem;
            font-size: 1rem;
            color: var(--black);
            background: var(--white);
            border: 2px solid var(--gray-200);
            border-radius: 0;
            transition: var(--transition);
            font-family: inherit;
        }

        .form-group input:focus {
            outline: none;
            border-color: var(--black);
            box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
        }

        .form-group input::placeholder {
            color: #9ca3af;
        }

        .btn {
            width: 100%;
            padding: 1rem;
            background: var(--black);
            color: var(--white);
            border: 2px solid var(--black);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            margin-top: 1rem;
            border-radius: 0;
        }

        .btn:hover {
            background: var(--white);
            color: var(--black);
            transform: translateY(-2px);
            box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
        }

        .btn:active {
            transform: translateY(0);
            box-shadow: none;
        }

        .btn:disabled {
            opacity: 0.7;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .alert {
            padding: 1rem;
            margin-bottom: 2rem;
            border-left: 4px solid;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .alert-error {
            background: #fef2f2;
            border-color: #ef4444;
            color: #991b1b;
        }

        .alert-success {
            background: #f0fdf4;
            border-color: #22c55e;
            color: #166534;
        }

        /* GitHub Link Style */
        .github-link {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 2rem;
            color: var(--gray-800);
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 500;
            transition: var(--transition);
            padding: 0.5rem 1rem;
            border-radius: 8px;
        }

        .github-link:hover {
            color: var(--black);
            background-color: var(--gray-100);
            transform: translateY(-2px);
        }

        /* Responsive Design */
        @media (max-width: 960px) {
            .split-layout {
                flex-direction: column;
            }

            .brand-section {
                flex: 0 0 30%;
                padding: 2rem;
                align-items: center;
                text-align: center;
            }

            .brand-pattern {
                opacity: 0.3;
            }

            .brand-logo {
                margin-bottom: 1rem;
                justify-content: center;
            }

            .brand-title {
                font-size: 2rem;
                margin-bottom: 0.5rem;
            }

            .brand-subtitle {
                display: none;
            }

            .form-section {
                flex: 1;
                padding: 2rem;
                align-items: flex-start;
            }

            .form-container {
                margin: 0 auto;
                padding: 0;
            }
        }
    </style>
</head>

<body>
    <div class="split-layout">
        <!-- Left Side: Brand -->
        <div class="brand-section">
            <div class="brand-pattern"></div>
            <div class="brand-content">
                <div class="brand-logo">
                    <img src="/static/images/landppt-logo.png" alt="LandPPT Logo">
                    <span style="font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;">LandPPT</span>
                </div>
                <h1 class="brand-title">
                    让演示<br>
                    更具创造力
                </h1>
                <p class="brand-subtitle">
                    登录您的账户，开始创建令人惊叹的演示文稿。
                    体验极简主义与高效能的完美结合。
                </p>
            </div>
        </div>

        <!-- Right Side: Login Form -->
        <div class="form-section">
            <div class="form-container">
                <div class="form-header">
                    <h2>欢迎回来</h2>
                    <p>请输入您的账号信息以继续</p>
                </div>

                {% if error %}
                <div class="alert alert-error">
                    <i class="fas fa-exclamation-circle"></i>
                    {{ error }}
                </div>
                {% endif %}

                {% if success %}
                <div class="alert alert-success">
                    <i class="fas fa-check-circle"></i>
                    {{ success }}
                </div>
                {% endif %}

                <form method="post" action="/auth/login" id="loginForm">
                    <div class="form-group">
                        <label for="username">用户名</label>
                        <div class="input-wrapper">
                            <input type="text" id="username" name="username" required placeholder="输入您的用户名"
                                value="{{ username or '' }}" autocomplete="username">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password">密码</label>
                        <div class="input-wrapper">
                            <input type="password" id="password" name="password" required placeholder="输入您的密码"
                                autocomplete="current-password">
                        </div>
                    </div>

                    <button type="submit" class="btn" id="loginBtn">
                        <span>登录</span>
                        <i class="fas fa-arrow-right" style="font-size: 0.8em;"></i>
                    </button>
                </form>

                <div style="text-align: center;">
                    <a href="https://github.com/sligter/LandPPT" target="_blank" class="github-link">
                        <i class="fab fa-github" style="font-size: 1.2em;"></i>
                        <span>LandPPT</span>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.getElementById('loginForm').addEventListener('submit', function (e) {
            const btn = document.getElementById('loginBtn');
            const originalContent = btn.innerHTML;

            // Add loading state
            btn.disabled = true;
            btn.innerHTML = '<i class="fas fa-circle-notch fa-spin"></i> <span>登录中...</span>';
        });

        // Add simple entrance animation
        document.addEventListener('DOMContentLoaded', () => {
            const formContainer = document.querySelector('.form-container');
            formContainer.style.opacity = '0';
            formContainer.style.transform = 'translateY(20px)';
            formContainer.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out';

            setTimeout(() => {
                formContainer.style.opacity = '1';
                formContainer.style.transform = 'translateY(0)';
            }, 100);
        });
    </script>
</body>

</html>